feat(wallet): wire RemoteFeatureFlagController into default initialization#8969
Open
sirtimid wants to merge 3 commits into
Open
feat(wallet): wire RemoteFeatureFlagController into default initialization#8969sirtimid wants to merge 3 commits into
RemoteFeatureFlagController into default initialization#8969sirtimid wants to merge 3 commits into
Conversation
sirtimid
added a commit
that referenced
this pull request
Jun 2, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
that referenced
this pull request
Jun 8, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
c704d42 to
6e59aee
Compare
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
sirtimid
added a commit
that referenced
this pull request
Jun 8, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6e59aee to
6ea8b4d
Compare
Member
Author
|
@metamaskbot publish-previews |
Member
Author
|
@SocketSecurity ignore npm/@metamask/remote-feature-flag-controller@4.2.2 |
sirtimid
added a commit
that referenced
this pull request
Jun 8, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6ea8b4d to
ae15713
Compare
…ization Adds `RemoteFeatureFlagController` to the wallet's default controller ensemble, exposing per-platform constructor values through a new `instanceOptions.remoteFeatureFlagController` slot: `clientConfigApiService`, `getMetaMetricsId`, `clientVersion`, `prevClientVersion`, `fetchInterval`, and `disabled`. Each is injectable with an inert/neutral default so the controller is usable headlessly; extension and mobile inject their own values. The controller's messenger is a plain namespaced child with no delegation. `prevClientVersion` lets consumers trigger feature-flag cache invalidation when the client version changes between sessions. Closes #8794 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tureFlagController Migrates the RemoteFeatureFlagController instance to the per-controller directory convention (introduced by #8953, extended by #8977): `instances/remote-feature-flag-controller/` now holds the config, the colocated test, and a `RemoteFeatureFlagControllerInstanceOptions` type in its own `types.ts`. `InstanceSpecificOptions` references that type instead of an inline shape, and `instances/index.ts` + the CODEOWNERS `## Initialization` entry use the directory form. No public exports or option shapes change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ae15713 to
3989ae5
Compare
Member
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
sirtimid
added a commit
to MetaMask/metamask-extension
that referenced
this pull request
Jun 8, 2026
…r [REVERT BEFORE MERGE] TEMPORARY, testing-only. Bumps the `@metamask/wallet` npm alias from the ApprovalController preview (`2.0.0-preview-ecd6b75`) to `2.0.0-preview-3989ae5`, which additionally wires `RemoteFeatureFlagController` (MetaMask/core#8969), so this draft PR can exercise CI against the real wiring before a `@metamask/wallet` release exists. Also adds the `@metamask/remote-feature-flag-controller` edge to the `@metamask/wallet` LavaMoat policy entries (the preview wallet now imports it). Revert this commit and bump `@metamask/wallet` to the published release once it includes #8969. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
to MetaMask/metamask-extension
that referenced
this pull request
Jun 8, 2026
…r [REVERT BEFORE MERGE] TEMPORARY, testing-only. Bumps the `@metamask/wallet` npm alias from the ApprovalController preview (`2.0.0-preview-ecd6b75`) to `2.0.0-preview-3989ae5`, which additionally wires `RemoteFeatureFlagController` (MetaMask/core#8969), so this draft PR can exercise CI against the real wiring before a `@metamask/wallet` release exists. Also adds the `@metamask/remote-feature-flag-controller` edge to the `@metamask/wallet` LavaMoat policy entries (the preview wallet now imports it). Revert this commit and bump `@metamask/wallet` to the published release once it includes #8969. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Jun 8, 2026
Construct RemoteFeatureFlagController through @metamask/wallet instead of mobile's local Engine controller-init wiring, mirroring the ApprovalController migration on the base branch and the KeyringController (#30368) and StorageService (#30922) precedents. This is the mobile counterpart to core PR MetaMask/core#8969. - Delete the local remote-feature-flag-controller init + messenger (and both tests). The remote-feature-flag-controller/ helper dir (getFeatureFlagApp* helpers + isRemoteFeatureFlagOverrideActivated) is kept and reused from the new wiring. - Drop RemoteFeatureFlagController from the controller-init registry (Engine.ts), the MESSENGER_FACTORIES map (messengers/index.ts), and the MessengerClientsToInitialize union (types.ts). It is kept in the MessengerClients type, the background state map, its Actions/Events unions, and the BACKGROUND_STATE_CHANGE_EVENT_NAMES Redux-bridge list (the wallet-owned controller emits stateChange on the same root bus). - Pass mobile's values through instanceOptions.remoteFeatureFlagController when constructing the Wallet (wallet-init/initialization.ts): clientConfigApiService (ClientType.Mobile + environment/distribution), getMetaMetricsId, clientVersion, prevClientVersion, fetchInterval, and the initial disabled value. - Preserve the client-side startup orchestration the wallet does NOT perform: the disabled/override logging and the startup updateRemoteFeatureFlags() fetch now run in the Engine constructor after the instance is resolved. - Resolve the instance via wallet.getInstance('RemoteFeatureFlagController') so RemoteFeatureFlagController:* consumers on the shared root messenger resolve the wallet-owned instance. - Add Engine integration tests for the preserved startup orchestration (disabled -> log + skip fetch; success -> "Feature flags updated"; failure -> "Feature flags update failed:"), restoring the coverage of the deleted remote-feature-flag-controller-init test. No functional changes. CHANGELOG entry: null Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Jun 8, 2026
Bumps the temporary npm-alias pin from the RFFC-free preview (ecd6b75) to the 4-controller preview (2.0.0-preview-3989ae5 = the core#8969 branch head), which wires RemoteFeatureFlagController into @metamask/wallet's default initialization. This is required for the RFFC migration in the previous commit to typecheck and to avoid a "RemoteFeatureFlagController:getState already registered" collision (the wallet now registers the controller mobile used to init locally). Kept as a direct npm alias in package.json (not the previewBuilds plugin) — the form that passes CI's immutable resolve. @metamask-previews/* is already preapproved in .yarnrc.yml, so the npm minimal-age gate does not block the fresh preview. `yarn install --immutable` exits 0 with no YN0028. Still TEMPORARY / DO NOT MERGE — revert this and pin the real @metamask/wallet release (the one including MetaMask/core#8969) before marking ready. CHANGELOG entry: null Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
This wires
RemoteFeatureFlagControllerinto@metamask/wallet's default controller initialization, so the wallet manages remote feature flags as part of its ensemble. It exposes the controller's standard messenger surface —RemoteFeatureFlagController:getState/:stateChangeplus its method-actions (updateRemoteFeatureFlags,enable,disable,setFlagOverride,removeFlagOverride,clearAllFlagOverrides).@metamask/walletis the shared controller-integration layer formetamask-extension,metamask-mobile, andwallet-cli. The controller's constructor values that differ between those clients are therefore injectable via a newinstanceOptions.remoteFeatureFlagControllerslot rather than hardcoded, each with a platform-agnostic default so a headless consumer can construct the wallet with no options at all. Values identical everywhere are not exposed.The controller's messenger is a plain namespaced child with no delegation — the controller's own messenger type only allows its own actions/events, and both clients already construct it that way. The per-client orchestration that reads
PreferencesController/OnboardingController(extension) or a basic-functionality selector (mobile) to enable/disable the controller is not part of the controller and is not delegated here: those sources aren't wallet controllers (mobile's isn't even a controller). Clients keep that orchestration in their own glue and drive it over the shared messenger via the exposedRemoteFeatureFlagController:enable/:disableactions; the wallet only takes the initialdisabledvalue and agetMetaMetricsIdcallback as injectable options.Per-environment options
clientConfigApiServicenew ClientConfigApiService({ fetch, config: { client: Extension, distribution, environment } })new ClientConfigApiService({ fetch, config: { client: Mobile, environment, distribution } })getMetaMetricsId() => MetaMetricsController:getMetaMetricsId() => analyticsId() => ''clientVersiongetBaseSemVerVersion()getBaseSemVerVersion()'0.0.0'prevClientVersionpersistedState.AppMetadataController.currentAppVersionpersistedState.AppMetadataController.currentAppVersionundefinedfetchInterval15 * 60 * 1000__DEV__ ? 1000 : DEFAULT_FETCH_INTERVALdisabled!completedOnboarding || !useExternalServices!selectBasicFunctionalityEnabled(state)false)The dynamic enable/disable toggling (subscribing to the sources above and calling
enable/disable) stays client-side; only the initialdisabledvalue is an option here.References
Current client construction sites (live
main):Closes #8794.
Checklist
🤖 Generated with Claude Code
Note
Medium Risk
Touches shared wallet bootstrap and remote flag fetching; misconfigured clients could silently see no flags, and duplicate controller wiring elsewhere could still collide like other default controllers.
Overview
Adds
RemoteFeatureFlagControllerto@metamask/wallet’s default initialization so extension, mobile, and wallet-cli get remote feature flags through the shared wallet messenger (getState,updateRemoteFeatureFlags, etc.).A new
instanceOptions.remoteFeatureFlagControllerslot forwards platform-specific settings (clientConfigApiService,getMetaMetricsId,clientVersion,prevClientVersion,fetchInterval,disabled) with headless-safe defaults (no-op fetch, empty metrics id,'0.0.0'semver). Clients that omit a real config API service get an empty flag set without failing.Also adds the
@metamask/remote-feature-flag-controllerdependency, exports the init config from the instances barrel, CODEOWNERS for the init folder, README dependency graph update, and unit/integration tests for defaults, injection, cache invalidation on version change, and wallet-level wiring.Reviewed by Cursor Bugbot for commit 3989ae5. Bugbot is set up for automated code reviews on this repo. Configure here.